Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oniyi-http-plugin-credentials

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oniyi-http-plugin-credentials

A plugin for oniyi-http-client for automatic attachment of user credentials

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

oniyi-http-plugin-credentials NPM version Dependency Status Coverage percentage

A plugin for oniyi-http-client for automatic attachment of user credentials

This plugin is designed to work with the third-party login component of loopback. The third-party login component is heavily based on passportjs. To make things work more broadly, I also wrote a loopback extension to allow the usage of custom auth schemes oniyi-loopback-passport-custom-schemes.

Installation

$ npm install --save oniyi-http-plugin-credentials

Usage

const OniyiHttpClient = require('oniyi-http-client');
const oniyiHttpPluginCredentials = require('oniyi-http-plugin-credentials');

const clientOptions = {};
const httpClient = new OniyiHttpClient(clientOptions);

const pluginOptions = {};
const plugin = oniyiHttpPluginCredentials(pluginOptions);

httpClient.use(plugin);

Plugin Options

The oniyi-http-plugin-credentials module exports a factory function that takes a single options argument.

available options are:

  • providerName: undefined (string, required) - name of the passport-strategy to be used. Note: passport-strategy must be registered first
  • removeUserProp: true (boolean, optional) - indicates if the user property should be removed from the request options
  • areCredentialsExpired: (function, optional) - async function that checks if credentials are expired. Must take two arguments (credentials, callback(err, isExpired))
  • refreshCredentials: (function, optional) - async function that provides refreshed credentials. Must take three arguments (strategy, currentCredentials, callback(err, freshCredentials))
  • makeAuthParams: (function, optional) - async function that provides an object literal to be merged with request parameters. Must take two arguments (credentials, callback(err, authParams))
  • userRelationProp: /-link$/.test(pluginOptions.providerName) ? 'credentials' : 'identities', (string, optional) - name of the relation on req.user that we should search for user credentials
  • credentialsProp: 'credentials' (string, optional) - name of the property in the relation's document to be used for credentials

All options of type function have default values that can with OAuth2 strategies.

License

MIT © Benjamin Kroeger

Keywords

FAQs

Package last updated on 06 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc